package org.example.annotation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Import;
import org.springframework.stereotype.Component;

@Component
@Import(MyBean.class)
public class BMyBean {

    @Autowired
    private ApplicationContext applicationContext;

    public void fun(){
        MyBean myBean = (MyBean) applicationContext.getBean("myBean");
        myBean.fun();
    }

}
